<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>类</title>
  <style>
    .aa {
      font-size: 30px;
    }

    .bb {
      background: rgb(112, 36, 36);
    }

    .cc {
      width: 300px;
      height: 100px;
    }
  </style>
</head>
<body>
  <div id="div1" class="aa bb cc">这是div</div>

  <script src="./实战式教学/helpers.js"></script>
  <script>
    const div1 = document.getElementById("div1");
    div1.onclick = function(){
      // this.className = 'bb cc'

      // console.log(this.classList);
      // let classList = this.classList
      // classList.add('dd')

      // classList.remove('bb')

      // addClass(this,'dd')
      // removeClass(this,'bb')
      // console.log(hasClass(this,'aa'));
      // replaceClass(this,'aa','ee')
      toggleClass(this, 'aa')
    }
  </script>
</body>
</html>